package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements IOPeration{

    public void work(BookList bookList){
        System.out.println("添加图书!");
        Scanner in = new Scanner(System.in);
        System.out.println("输入图书的名字");
        String name = in.nextLine();
        System.out.println("输入图书的作者");
        String author = in.nextLine();
        System.out.println("输入图书的类型");
        String type = in.nextLine();
        System.out.println("输入图书的价格");
        int price = in.nextInt();

        int currentSize = bookList.getUsedSize();
        Book book = new Book(name,author,price,type);
        bookList.setBooks(currentSize,book);
        bookList.setUsedSize(currentSize+1);

    }
}
